<?php


namespace App\Http\Controllers;


use App\Models\Product\Type\Article;
use App\Services\ArticleService;

/**
 * 文章管理-控制器
 * @author aaron
 * @since 2021/6/9
 * Class ArticleController
 * @package App\Http\Controllers
 */
class ArticleController extends Backend
{
    /**
     * 构造函数
     * @author aaron
     * @since 2021/6/9
     * ArticleController constructor.
     */
    public function __construct()
    {
        parent::__construct();
        $this->service = new ArticleService();
    }

    public function delete()
    {
        $id = intval(request('id', ''));
        $productTypeArticleCount = Article::query()->where('article_id', '=', $id)->count();
        if ($productTypeArticleCount) {
            return message("删除失败，请先取消绑定", false);
        }
        return parent::delete(); // TODO: Change the autogenerated stub
    }
}
